package com.c.service.impl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.c.entity.OrderForm;
import com.c.entity.PayLog;
import com.c.mapper.PayLogMapper;
import com.c.service.PayLogService;
import com.c.utils.PageResult;
import com.c.utils.QueryPageBean;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author wangxiangli
 * @create 2022-12-25-12:30
 */
@Service
@Transactional
public class PayLogServiceImpl extends ServiceImpl<PayLogMapper, PayLog> implements PayLogService {

    @Override
    public PageResult pageQuery2(QueryPageBean queryPageBean) {
        //统计所有的数据
        Long total = baseMapper.selectCount(null);
        if(total>=queryPageBean.getPageSize()*(queryPageBean.getCurrentPage()-1)){
            Integer[] payLogids=baseMapper.selectIdsByCondtion(queryPageBean.getQueryString(),queryPageBean.getPageSize()*(queryPageBean.getCurrentPage()-1),queryPageBean.getPageSize());
            if(payLogids==null){
                return null;
            }
            List<PayLog> payLogs=baseMapper.selectPayLogs(payLogids);
            return new PageResult(total,payLogs);
        }
        return null;
    }
}
